<?php


if (!defined("EXPONENT")) exit("");

// Sanitize required querystring parameter
$_GET['id'] = intval($_GET['id']);

$rsnews = $db->selectObject("rsnewsitem","id=" . $_GET['id']);
$iloc = null;
if ($rsnews != null) {
	$loc = unserialize($rsnews->location_data);
	$iloc = $loc;
	$iloc->int = $rsnews->id;
	
	if (exponent_permissions_check("delete_item",$loc) || ($iloc != null && exponent_permissions_check("delete_item",$iloc))) {
		$db->delete("rsnewsitem","id=" . $_GET['id']);
		$db->delete("rsnewsitem_wf_info","real_id=".$_GET['id']);
		$db->delete("rsnewsitem_wf_revision","wf_original=".$_GET['id']);
		
		exponent_flow_redirect();
	} else {
		echo SITE_403_HTML;
	}
} else {
	echo SITE_404_HTML;
}

?>